<template>
  <div class="setting-yly-container">

    <!-- 表格 -->
    <div>
      <el-table :data="logList" style="width:100%" stripe>
        <el-table-column prop="merchant_id" label="操作人ID" align="center"></el-table-column>
        <el-table-column prop="operation_type" label="操作类型" align="center"></el-table-column>
        <el-table-column prop="operation_id" label="被操作数据ID" align="center"></el-table-column>
        <el-table-column prop="module_name" label="操作模块" align="center"></el-table-column>
        <el-table-column prop="format_create_time" label="创建时间" align="center"></el-table-column>
      </el-table>
    </div>

    <!-- 分页 -->
    <div style="text-align:right;margin:15px 15px">
      <el-pagination class="page"
        background
        layout="total, prev, pager, next, jumper"
        :total="count"
        :page-size="12"
        :current-page="page"
        @size-change="changePage"
        @current-change="changePage">
      </el-pagination>
    </div>
  </div>
</template>

<script>
import { getLogList } from '@/api/operation'

export default {
  name: 'setting-yly',
  data() {
    return {
      page: 1,
      count: 1,

      logList: [],
    }
  },
  mounted() {
    this.getLogList();

  },
  methods: {
    /**
     * 获取积分商品列表
     */
    getLogList() {
      const params = {
        key: this.$store.state.app.activeApp.saa_key,
        page: this.page,
        limit: 12
      };
      getLogList(params).then(res => {
        if(res.status === 200){
          this.logList = res.data;
          this.count = parseInt(res.count);
        }else if(res.status === 204){
          this.logList = [];
          this.count = 1;
        }else{
          this.$message.error(res.message);
        }
      })
    },
    /**
     * 翻页
     */
    changePage(page) {
      this.page = page;
      this.getLogList();
    },
  },
}
</script>

<style lang="scss" scoped>
.setting-yly-container{
  min-height: calc(100vh - 100px);
  margin: 20px;
  background-color: #fff;
  padding:25px;
  box-shadow: 0px 0px 4px 0px rgba(115, 115, 115, 0.2);
}

</style>